# python练习题
#编写一个类似于ATM机的软件程序
#
#
# 需要先在系统中准备一些账户和数据
# 包括
# 账户号码    密码    存款额度
#
# 完成以下功能
# 1.模拟用户输入账户和密码,登录软件
#   如果密码输入错误3次，退出此次登录
# 用户登录成功之后，可以进行
# 2.取款，输入的金额必须在存款额度内，取款后，扣减对应的金额
# 3.转账，将本账户的钱转入其他账户，要保证其他账户的正确性和转账金额的足够
# 4.查询，查询当前账户的存款金额
# 5.退出，用户输入对应的关键字 退出系统

# dict1={"1234567890":["981026","100000"],"12345678901":["991026","20000"]}
# print(dict1)
# i=1
# while i<=3:
#     print("请输入序号选取功能：1.登录2.取款3.转账4.查询5.退出")
#     info=int(input("请输入序号："))
#     if info==1:
#         username=input("请输入用户名：")
#         password=input("请输入密码：")
#         if username in dict1.keys():



# import pymysql
#
# def sql_quary(sql):
#     conn=pymysql.connect(host='localhost',port=3306,user='root',password='root',
#                          db="lianxi",charset="utf8")
#     cur=conn.cursor()
#     num=cur.execute(sql)
#     info=cur.fetchone()
#     cur.close()
#     conn.cursor()
#     if num==1:
#         return num,info[0]
#     else:
#         return num,None
#
# print(sql_quary("SELECT id FROM atm WHERE id=1001;"))
#
# def sql_modify(sql):
#     conn=pymysql.connect(host='localhost',port=3306,user='root',password='root',
#                          db="lianxi",charset="utf8")
#     cur=conn.cursor()
#     num=cur.execute(sql)
#     conn.commit()
#     # info=cur.fetchall()
#     cur.close()
#     conn.cursor()
#     return num
# def check_account(id):
#     sql="select id from atm where id={};".format(id)
#     result=sql_quary(sql)
#     if result[0]==1:
#         return True
#     else:
#         return False
#
# def check_pwd(userid,pwd):
#     sql = "select id from atm where id={} and password={};".format(userid,pwd)
#     result = sql_quary(sql)
#     if result[0] == 1:
#         return True
#     else:
#         return False
#
# def check_money(id):
#     sql = "select id from atm where id={};".format(id)
#     result=sql_quary(sql)
#     return result[1]
# print(check_money(1002))
#
# def modify_money(id,money,sign):
#     if sign=="+":
#         sql='upadate atm set money=money+{} where id={}'.format(money,id)
#     else:
#         sql = 'upadate atm set money=money-{} where id={}'.format(money, id)
#     if sql_modify(sql)==1:
#         return True
#     else:
#         return False
#
# mark=True
# while mark:
#     name=int(input("请输入正确的用户名："))
#     if check_account(name)==True:
#        for i in range(3):
#             pwd=input("请输入正确的密码：")
#             if check_pwd(name, pwd)==True:
#
#         else:
#             break
#     else:
#         break
#






























